import {
  Component,
  OnInit,
  ViewEncapsulation,
  ChangeDetectionStrategy,
  OnChanges,
  SimpleChanges,
  Input,
} from '@angular/core';
import { InputNumber } from '../core/api';

@Component({
  selector: 'lv-tree-indent',
  templateUrl: './tree-indent.component.html',
  styles: [],
  encapsulation: ViewEncapsulation.None,
  changeDetection: ChangeDetectionStrategy.OnPush,
  host: {
    class: 'lv-tree-indent',
  },
})
export class TreeIndentComponent implements OnInit, OnChanges {
  @Input() lvIsEnd: boolean[] = [];
  @Input() lvIsStart: boolean[] = [];
  @Input() @InputNumber() lvLevel = 0; // 层级

  list: number[] = [];

  ngOnInit(): void {}

  ngOnChanges(changes: SimpleChanges): void {
    const { lvLevel } = changes;
    if (lvLevel) {
      this.list = [...new Array(lvLevel.currentValue || 0)];
    }
  }
}
